Back out the put-labels-into-the-standard-focus-chain patches from bug
authorOwen Taylor <otaylor@redhat.com>
Thu, 11 Mar 2004 19:07:45 +0000 (19:07 +0000)
committerOwen Taylor <otaylor@src.gnome.org>
Thu, 11 Mar 2004 19:07:45 +0000 (19:07 +0000)
Thu Mar 11 13:58:24 2004  Owen Taylor  <otaylor@redhat.com>

        * gtk/gtkmessagedialog.c gtk/gtklabel.c: Back out the
        put-labels-into-the-standard-focus-chain patches
        from bug #59707.

        * gtk/gtklabel.c (gtk_label_focus): Only put the
        label in the tab chain when the control key is pressed.

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtklabel.c
gtk/gtkmessagedialog.c

index 8d43a5eef439ff50ca076e9a7ebc8760f13c8b7a..f47b2dde786f4ccf782132d01b1fcac979530f40 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+Thu Mar 11 13:58:24 2004  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkmessagedialog.c gtk/gtklabel.c: Back out the
+       put-labels-into-the-standard-focus-chain patches 
+       from bug #59707.
+
+       * gtk/gtklabel.c (gtk_label_focus): Only put the
+       label in the tab chain when the control key is pressed.
+
 2004-03-11  Federico Mena Quintero  <federico@ximian.com>
 
        * gtk/gtkfilechooserdefault.c (error_message_with_parent): Use a
index 8d43a5eef439ff50ca076e9a7ebc8760f13c8b7a..f47b2dde786f4ccf782132d01b1fcac979530f40 100644 (file)
@@ -1,3 +1,12 @@
+Thu Mar 11 13:58:24 2004  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkmessagedialog.c gtk/gtklabel.c: Back out the
+       put-labels-into-the-standard-focus-chain patches 
+       from bug #59707.
+
+       * gtk/gtklabel.c (gtk_label_focus): Only put the
+       label in the tab chain when the control key is pressed.
+
 2004-03-11  Federico Mena Quintero  <federico@ximian.com>
 
        * gtk/gtkfilechooserdefault.c (error_message_with_parent): Use a
index 8d43a5eef439ff50ca076e9a7ebc8760f13c8b7a..f47b2dde786f4ccf782132d01b1fcac979530f40 100644 (file)
@@ -1,3 +1,12 @@
+Thu Mar 11 13:58:24 2004  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkmessagedialog.c gtk/gtklabel.c: Back out the
+       put-labels-into-the-standard-focus-chain patches 
+       from bug #59707.
+
+       * gtk/gtklabel.c (gtk_label_focus): Only put the
+       label in the tab chain when the control key is pressed.
+
 2004-03-11  Federico Mena Quintero  <federico@ximian.com>
 
        * gtk/gtkfilechooserdefault.c (error_message_with_parent): Use a
index 8d43a5eef439ff50ca076e9a7ebc8760f13c8b7a..f47b2dde786f4ccf782132d01b1fcac979530f40 100644 (file)
@@ -1,3 +1,12 @@
+Thu Mar 11 13:58:24 2004  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkmessagedialog.c gtk/gtklabel.c: Back out the
+       put-labels-into-the-standard-focus-chain patches 
+       from bug #59707.
+
+       * gtk/gtklabel.c (gtk_label_focus): Only put the
+       label in the tab chain when the control key is pressed.
+
 2004-03-11  Federico Mena Quintero  <federico@ximian.com>
 
        * gtk/gtkfilechooserdefault.c (error_message_with_parent): Use a
index 8d43a5eef439ff50ca076e9a7ebc8760f13c8b7a..f47b2dde786f4ccf782132d01b1fcac979530f40 100644 (file)
@@ -1,3 +1,12 @@
+Thu Mar 11 13:58:24 2004  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkmessagedialog.c gtk/gtklabel.c: Back out the
+       put-labels-into-the-standard-focus-chain patches 
+       from bug #59707.
+
+       * gtk/gtklabel.c (gtk_label_focus): Only put the
+       label in the tab chain when the control key is pressed.
+
 2004-03-11  Federico Mena Quintero  <federico@ximian.com>
 
        * gtk/gtkfilechooserdefault.c (error_message_with_parent): Use a
index 91cfa1c48a4334fa19e63080ee4bded6ac121cfe..ab5364a19570e3952a54d7faf0867c00ae7a80d8 100644 (file)
@@ -147,6 +147,8 @@ static gboolean gtk_label_mnemonic_activate (GtkWidget         *widget,
                                             gboolean           group_cycling);
 static void     gtk_label_setup_mnemonic    (GtkLabel          *label,
                                             guint              last_key);
+static gboolean gtk_label_focus             (GtkWidget         *widget,
+                                            GtkDirectionType   direction);
 
 /* For selectable lables: */
 static void gtk_label_move_cursor        (GtkLabel        *label,
@@ -248,6 +250,7 @@ gtk_label_class_init (GtkLabelClass *class)
   widget_class->hierarchy_changed = gtk_label_hierarchy_changed;
   widget_class->screen_changed = gtk_label_screen_changed;
   widget_class->mnemonic_activate = gtk_label_mnemonic_activate;
+  widget_class->focus = gtk_label_focus;
 
   class->move_cursor = gtk_label_move_cursor;
   class->copy_clipboard = gtk_label_copy_clipboard;
@@ -2812,6 +2815,27 @@ gtk_label_get_use_underline (GtkLabel *label)
   return label->use_underline;
 }
 
+static gboolean
+gtk_label_focus (GtkWidget         *widget,
+                GtkDirectionType   direction)
+{
+  GtkLabel *label = GTK_LABEL (widget);
+  GdkEvent *event;
+  GdkModifierType state;
+  
+  /* We want to be in the tab chain only if we are selectable
+   * and the Control key is pressed
+   */
+  if (label->select_info == NULL)
+    return FALSE;
+
+  if (!gtk_get_current_event_state (&state))
+    return FALSE;
+
+  if (state & GDK_CONTROL_MASK)
+    return GTK_WIDGET_CLASS (parent_class)->focus (widget, direction);
+}
+
 /* Compute the X position for an offset that corresponds to the "more important
  * cursor position for that offset. We use this when trying to guess to which
  * end of the selection we should go to when the user hits the left or
index 06a6ee187b545abd8c9a93d79f43ea4edec16c72..34a08443565d80d4df9d3c9b2b75bc6b2342ddde 100644 (file)
@@ -36,8 +36,6 @@
 
 static void gtk_message_dialog_class_init (GtkMessageDialogClass *klass);
 static void gtk_message_dialog_init       (GtkMessageDialog      *dialog);
-
-static void gtk_message_dialog_map        (GtkWidget             *widget);
 static void gtk_message_dialog_style_set  (GtkWidget             *widget,
                                            GtkStyle              *prev_style);
 
@@ -99,7 +97,6 @@ gtk_message_dialog_class_init (GtkMessageDialogClass *class)
 
   parent_class = g_type_class_peek_parent (class);
   
-  widget_class->map = gtk_message_dialog_map;
   widget_class->style_set = gtk_message_dialog_style_set;
 
   gobject_class->set_property = gtk_message_dialog_set_property;
@@ -515,44 +512,6 @@ gtk_message_dialog_add_buttons (GtkMessageDialog* message_dialog,
   g_object_notify (G_OBJECT (message_dialog), "buttons");
 }
 
-static void
-gtk_message_dialog_map (GtkWidget *widget)
-{
-  GtkWindow *window;
-
-  window = GTK_WINDOW (widget);
-
-  /* If a default button has not been chosen, then the selectable label will get
-   * the focus.  This looks bad, so give the focus to a button in this case.
-   */
-
-  if (!gtk_window_get_focus (window))
-    {
-      GtkWidget *focus_widget;
-
-      if (window->default_widget)
-       focus_widget = window->default_widget;
-      else
-       {
-         GList *children;
-
-         children = gtk_container_get_children (GTK_CONTAINER (GTK_DIALOG (widget)->action_area));
-
-         if (children)
-           focus_widget = GTK_WIDGET (children->data);
-         else
-           focus_widget = NULL;
-
-         g_list_free (children);
-       }
-
-      if (focus_widget)
-       gtk_widget_grab_focus (focus_widget);
-    }
-
-  GTK_WIDGET_CLASS (parent_class)->map (widget);
-}
-
 static void
 gtk_message_dialog_style_set (GtkWidget *widget,
                               GtkStyle  *prev_style)